package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description：
 * User：user
 * DATE:2021-10-29
 * Time:17:41
 */
interface  IShape{

    int a = 1;
    int b = 2;
    void draw();

    /*//默认静态常量公开
    public int a = 0;
    public static int b = 0;
    public static final  int c = 0;

        //默认都是public abstract
    public abstract  void draw();*/

    /*default  public void func(){
        //必须用default修饰否则会报错
        System.out.println("这是一个默认方法");
    }*/
}
class Cycle implements  IShape{
    @Override
    public void draw() {
        System.out.println("圆圈");
    }
}
class Rect implements  IShape{

    @Override
    public void draw() {
        System.out.println("rect");
    }
}
public class Test {
    public static void drawMap(IShape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        //Shape shape = new Shape();
        //接口是抽象类的更进一步，不能被实例化
        IShape iShape = new Cycle();
        drawMap(iShape);
        drawMap(new Rect());

    }
}
